#!/bin/bash
#linuxsamu
#
PRG={{ fastdfs_dir }}/bin/fdfs_storaged
CONF={{ fastdfs_dir }}/fdfs/storage.conf
if [ ! -f $PRG ]; then
  echo "file $PRG does not exist!"
  exit 2
fi

if [ ! -f $CONF ]; then
  echo "file $CONF does not exist!"
  exit 2
fi

CMD="$PRG $CONF"

start() {
 	echo "Starting FastDFS tracker server!"
	$CMD &
}
stop() {
        kill `ps -ef|grep ${PRG}|grep -v "grep"|awk '{print $2}'`
}
restart() {
        stop
        start
}

case "$1" in
  start)
  	start
	;;
  stop)
  	stop
	;;
  restart|reload)
  	restart
	;;
  *)
	echo $"Usage: $0 {start|stop|status|restart|condrestart}"
	exit 1
esac

